home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / var / lib / dpkg / info / xkb-data.preinst < prev    next >
Encoding:
Text File  |  2006-11-28  |  1.9 KB  |  61 lines

  1. #! /bin/sh
  2.  
  3. set -e
  4. rm_conffile() {
  5.       CONFFILE="$1"
  6.       OLD="$2"
  7.  
  8.       if [ -e "$CONFFILE" ]; then
  9.               md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  10.               [ "$md5sum" != "$OLD" ] || rm -f "$CONFFILE"
  11.      fi
  12. }
  13.  
  14. case "$1" in
  15.     install|upgrade)
  16.         # TODO: we should really have rollback code for all of this.
  17.         if dpkg --compare-versions "$2" le "0.9-1"; then
  18.             (echo; cat /var/lib/dpkg/status) |\
  19.               sed -e '1,/^Package: xkb-data$/d' -e '/^$/,$d' |\
  20.               sed -e '1,/^Conffiles:/d' -e '/^Description:/,$d' |\
  21.               while read cf md5sum
  22.             do
  23.                 rm_conffile $cf $md5sum
  24.             done
  25.  
  26.             for link in xfree86 xfree86.lst xfree86.xml xorg xorg.lst xorg.xml; do
  27.                 rm -f "/etc/X11/xkb/rules/$link"
  28.             done
  29.  
  30.             for dir in compat geometry keycodes keymap rules semantics symbols types; do
  31.                 if [ -d "/etc/X11/xkb/$dir" ]; then
  32.                     find "/etc/X11/xkb/$dir" -depth -type d -print0 | \
  33.                         xargs -0r rmdir --ignore-fail-on-non-empty
  34.                     if [ -d "/etc/X11/xkb/$dir" ]; then
  35.                         cat >&2 <<EOF
  36.  
  37. WARNING: /etc/X11/xkb/$dir had local changes! XKB configuration has
  38. moved to /usr/share/X11/xkb. Preserving as /etc/X11/xkb/$dir.dpkg-old.
  39. EOF
  40.                         mv "/etc/X11/xkb/$dir" "/etc/X11/xkb/$dir.dpkg-old"
  41.                     fi
  42.                 fi
  43.                 if [ "$dir" != rules ]; then
  44.                     if [ -f "/etc/X11/xkb/$dir.dir" ]; then
  45.                         cat >&2 <<EOF
  46.  
  47. WARNING: /etc/X11/xkb/$dir.dir had local changes! XKB configuration has
  48. moved to /usr/share/X11/xkb. Preserving as /etc/X11/xkb/$dir.dir.dpkg-old.
  49. EOF
  50.                         mv "/etc/X11/xkb/$dir.dir" "/etc/X11/xkb/$dir.dir.dpkg-old"
  51.                     fi
  52.                 fi
  53.             done
  54.         fi
  55.         ;;
  56. esac
  57.  
  58.  
  59.  
  60. exit 0
  61.